package demo5;

public class Tet {
    public static void main(String[] args) {
        Bird bird = new Bird();
        bird.AA();
    }



}

class A {

    public A AA() {
        return new A();
    }
}
class Animal extends A{

    String name;
    int age;

//    public Animal(String name) {
//        this.name = name;
//    }

    @Override
    public A AA() {
        return new A();
    }

    public void eat() {
        System.out.println(name + "吃东西");
    }
}

class Fish extends Animal {

//    public Fish(String name) {
//        super(name);//调用父类的带有一个参数的构造方法，给name初始化
//    }

    @Override
    public void eat() {
        System.out.println(name + "吃鱼食");
    }
}

class Bird extends Animal {

//    public Bird(String name) {
//        super(name);
//    }
    @Override
    public void eat() {
        System.out.println(name + "吃鸟粮");
    }

    @Override
    public Bird AA() {
        return new Bird();
    }
}

